package com.example.projecttest.service.impl;

import com.example.projecttest.mapper.DeptMapper;
import com.example.projecttest.poji.Dept;
import com.example.projecttest.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeptServicelmpl implements DeptService {
    @Autowired
    private DeptMapper deptMapper;
    @Override
    public List<Dept> list() {
        return deptMapper.list();
    }

    @Override
    public void delet(Integer id) {
        deptMapper.deleteById(id);
    }

    @Override
    public void insert(Dept dept) {
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.insertBydept(dept);
    }

    @Override
    public Dept sel(Integer id) {
       return deptMapper.sele(id);
    }

    @Override
    public void updata(Dept dept) {
        deptMapper.update(dept);
    }
}
